<?php
class vitalityCard extends ActionHandler 
{
	function handleRequest($jsonData)
	{
		$data = $jsonData['params'];
		$ownerId = $jsonData['userId'];
		$obj = $data['obj'];
		$objectIndex = $obj['objectIndex'];

		$return = array();	
		$return['err'] = 0;
		if ($this->useCard($jsonData))
		{
			$effectValue = $obj['effectValue'];
			$sql = " update ".$this->tables['user_profile']." set vitalityZeroTime = (vitalityZeroTime - ".($effectValue*120).") where id = ".$ownerId;
			$this->db->query($sql);
			$sql = " select vitalityZeroTime from ".$this->tables['user_profile']." where id = ".$ownerId;
			$result = $this->db->query($sql);
			$arr = $this->db->fetchArray($result);
			$return['vitalityZeroTime'] = $arr['vitalityZeroTime'];
		}
		$jsonData['params']['ownerId'] = $ownerId;
		require_once "handler/user/getPackage.php";
		$objhandler = new getPackage($this->db, $this->tables);
		$return['package'] = $objhandler->handleRequest($jsonData);
		return $return;
		
	}
}
?>